<%@ page import="com.cinsea.report.model.Reportfield" %>
<%@ page import="com.cinsea.form.model.Formfield" %>
<%@ page import="com.cinsea.report.service.ReportfieldService" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@include file="/common/common.jsp" %>
<%
    String humanid=StringUtil.null2String(request.getParameter("conut_worklogty_creator_value"));
    String title="";
    HumanService humanService=Env.getBean("humanService");
    OrgService orgService=Env.getBean("orgService");
    if(!StringUtil.isEmpty(humanid)){
        Human human=humanService.getFree(humanid);
        String objname=human.getObjname();
        String orgname=orgService.get(human.getOrgid()).getObjname();
        title = orgname+"-"+objname+"-<span id='datestr'>"+StringUtil.null2String(request.getParameter("conut_worklogty_createdate_value1"))+"</span>-"+"工作日志";
    }
%>
<head>
<%@include file="/common/head.jsp" %>
<script src='/dwr/interface/DataService.js'></script>
<script src='/dwr/interface/OptionService.js'></script>
<script src='/dwr/util.js'></script>
<script type="text/javascript">
    var store;
   var viewport=null;



    Ext.onReady(function(){
        /*var tb = new Ext.Toolbar({id:'toolbar1'});
          tb.render('pagemenubar');
          addBtn(tb,'快捷搜索','S','zoom',function(){onSearch2()});*/

    store = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({
            url: '/reportdata.do?&isnew=null&action=search&reportid=402881e8394959d10139497323bf0020&savedqueryid=&isjson=1&pagesize=20'
        }),
        reader: new Ext.data.JsonReader({
            sql1:'sql1',
            sql2:'sql2',
            root: 'result',
            totalProperty: 'totalCount',

             fields: ['processid','title','content','departments','result','commits','creator','createdate','createdept','starttime','ycrq']

        }),

        remoteSort: true
    });
    //store.setDefaultSort('id', 'desc');
        function titleRender(value, m, record, rowIndex, colIndex) {
            var createdept;
            try {
                createdept=record.get("createdept");
                createdept=createdept.substring(createdept.indexOf('>')+1);
                createdept=createdept.substring(0,createdept.indexOf('<'));
            } catch (e) {
            }
            var creator=record.get("creator");
            creator=creator.substring(creator.indexOf('>')+1);
            creator=creator.substring(0,creator.indexOf('<'));
            var title=record.get("title");
            title=title.substring(title.indexOf('>')+1);
            title=title.substring(0,title.indexOf('<'));
            var newtitle="<a onclick="+
            "javascript:onUrl('/form/formprocess.jsp?processid="+record.get("processid")+"&from=report','"+title+"','tab"+record.get("processid")+"')"
            +">"+(createdept?(createdept+"-"):"")+creator+"-"+record.get("createdate")+"-"+"工作日志"
                    +"</a>";
                return newtitle;

            }
    var sm=new Ext.grid.RowSelectionModel({selectRow:Ext.emptyFn});

          var cm = new Ext.grid.ColumnModel([{header:'标题',dataIndex:'title',width:40,sortable:false},{header:'内容',dataIndex:'content',width:40,sortable:false},{header:'创建日期',dataIndex:'ycrq',width:10,sortable:false},{header:'创建时间',dataIndex:'starttime',width:10,sortable:false}]);


   // cm.defaultSortable = true;

                    var autorefresh=new Ext.ux.grid.AutoRefresher({ interval:'5'})
                   var grid = new Ext.grid.GridPanel({
                       region: 'center',
                       store: store,
                       cm: cm,
                       trackMouseOver:false,
                       sm:sm ,
                       loadMask: true,
                       viewConfig: {

                             forceFit:true,

                           enableRowBody:true,
                           sortAscText:'升序',
                           sortDescText:'降序',
                           columnsText:'列定义',
                           getRowClass : function(record, rowIndex, p, store){
                               return 'x-grid3-row-collapsed';
                           }
                       },
                       bbar: new Ext.PagingToolbar({
                           pageSize: 20,

            store: store,
                           displayInfo:true,
                           beforePageText:'第',
                           afterPageText:'页\/{0}',
                           firstText:'第一页',
                           prevText:'上页',
                           nextText:'下页',
                           lastText:'最后页',
                           displayMsg:'显示 {0} - {1}条记录 \/ {2}',
                           emptyMsg:'没有结果返回'
        })
    });

    store.baseParams={"conut_worklogty_createdate_value":"<%=StringUtil.null2String(request.getParameter("conut_worklogty_createdate_value"))%>","conut_worklogty_createdate_value1":"<%=StringUtil.null2String(request.getParameter("conut_worklogty_createdate_value1"))%>","conut_worklogty_creator_value":"<%=StringUtil.null2String(request.getParameter("conut_worklogty_creator_value"))%>"}
     store.baseParams.datastatus='';

        store.on('load', function(st, recs) {
            Ext.getDom('sqlstr1').value=st.reader.jsonData.sql1;
            Ext.getDom('sqlstr2').value=st.reader.jsonData.sql2;
        });
     store.load({params:{start:0, limit:20}});
        Ext.get('divSearch').setVisible(true);
        	viewport = new Ext.Viewport({

                layout: 'border',
                items: [{region:'north',autoScroll:true,contentEl:'divSearch',split:true,collapseMode:'mini'},grid]
        	});

});

</script>
</head>
<body style="margin:10px,10px,10px,0px;padding:0px">


<div id="divSearch" style="display:none;">
 <div id="pagemenubar"></div>


     <form action="/reportdata.do?action=search&from=list&isnew=null&reportid=402881e8394959d10139497323bf0020" id="mainForm" name="mainForm" method="post">
     <input type="hidden" id="sqlwhere" name="sqlwhere" value=""/>
     <input type="hidden" id="sqlstr1" name="sqlstr1"/>
     <input type="hidden" id="sqlstr2" name="sqlstr2"/>



   <table id="myTable" class="formtable">

 <tr>

     <td  class="formvalue" width=70% nowrap align="center"><%=title%></td>


     <td  class="formvalue" width=15% nowrap  style="display:none;">
       <input type=text class=inputstyle style="width:100%" size=30 name="conut_worklogty_title_value" value=""/><span   id="conut_worklogty_title_valuespan"></span>
     </td>


     <td  class="formlabel" width=10% nowrap  style="display:none;">创建人</td>

     <td width=15% class='formvalue'  style="display:none;">

<button  class=Browser type=button onclick="getBrowser('conut_worklogty_creator_value','conut_worklogty_creatorspan','4','/form/formprocess.jsp?processid=','0');"></button>

<input type="hidden" id="conut_worklogty_creator_value" name="conut_worklogty_creator_value" value="<%=StringUtil.null2String(request.getParameter("conut_worklogty_creator_value"))%>"    >


</td>
     <td  class="formlabel" width=10% nowrap>日期</td>


             <td  class="formvalue" width=15% nowrap>
                    <input type=text class=inputstyle style="width:45%" size=10 name="conut_worklogty_createdate_value"  id="conut_worklogty_createdate_value" value="<%=StringUtil.null2String(request.getParameter("conut_worklogty_createdate_value"))%>" onclick="WdatePicker({onpicked:onSearch2})">
                    <span id="conut_worklogty_createdate_valuespan"   ></span>
                    <input type=text class=inputstyle style="width:45%" size=10 name="conut_worklogty_createdate_value1" id="conut_worklogty_createdate_value1"  value="<%=StringUtil.null2String(request.getParameter("conut_worklogty_createdate_value1"))%>"  onclick="WdatePicker()"  style="display:none;">
                    <span id="conut_worklogty_createdate_value1span"  >

                    </span>

                 </td>



   </table>
 </form>
 </div>


  <script language="javascript" type="text/javascript">
   function onSearch(pageno){
          document.mainForm.pageno.value=pageno;
       document.mainForm.submit();
   }

   function onSearch2(){
       $('#datestr').html($('#conut_worklogty_createdate_value').val());
       $('#conut_worklogty_createdate_value1').val($('#conut_worklogty_createdate_value').val());
        var o=$('#mainForm').serializeArray();
       var data={};
       for(var i=0;i<o.length;i++) {
           if(o[i].value!=null&&o[i].value!=""){
           data[o[i].name]=o[i].value;
           }
       }

	   store.baseParams=data;
        store.baseParams.datastatus='';
       store.load({params:{start:0, limit:20}});
   }
   $(document).keydown(function(event) {
       if (event.keyCode == 13) {
          onSearch2();
       }
   });

function openVcard(objid){

}
   </script>
<script type="text/javascript" language="javascript" src="/datapicker/WdatePicker.js"></script>
  </body>
</html>